package net.werup.am.collector.dao;
import net.werup.am.collector.domain.UnparsedXML;

import org.springframework.test.jpa.AbstractJpaTests;


public class UnparsedXMLDaoTest extends AbstractJpaTests {

	  private UnparsedXMLDao unparsedXMLDao;

	  public void setUnparsedXMLDao(UnparsedXMLDao unparsedXMLDao) {
	    this.unparsedXMLDao = unparsedXMLDao;
	  }

	  protected String[] getConfigLocations() {
	    return new String[] {"classpath:agentContext.xml"};
	  }

	  /* (non-Javadoc)
	 * @see org.springframework.test.AbstractTransactionalSpringContextTests#onSetUpInTransaction()
	 */
	protected void onSetUpInTransaction() throws Exception {
	    jdbcTemplate.execute("insert into UnparsedXML (id, name) values (1, 'testName')");
	  }

	  public void testFindByIdWhereRestaurantExists() {
		UnparsedXML unparsedXML = unparsedXMLDao.findById(1);
	    assertNotNull(unparsedXML);
	    assertEquals("testName", unparsedXML.getName());
	  }
}
